package br.com.dev.tcc.model;

import java.util.List;

import android.content.Context;
import br.com.dev.tcc.bean.Apolice;
import br.com.dev.tcc.database.DatabaseHelper;
import br.com.dev.tcc.database.dao.ApoliceDAO;

public class ApolicesModel {

	private DatabaseHelper dbhelper;
	private List<Apolice> lista;
	
	public ApolicesModel(Context context) {

		this.dbhelper = new DatabaseHelper(context);
	}

	public boolean salva(Apolice apolice) {
		
		ApoliceDAO dao = new ApoliceDAO(dbhelper);
		return dao.salva(apolice);
	}

	public boolean remove(Apolice apolice) {

		ApoliceDAO dao = new ApoliceDAO(dbhelper);
		return dao.removerApolice(apolice);
	}

	public List<Apolice> lista() {
		
		ApoliceDAO dao = new ApoliceDAO(dbhelper);
		lista = dao.lista();
		return lista;
	}
	
	public Apolice get(int position){
		return lista.get(position);
	}
}
